/*
 * Copyright (C) 2009 M. Hautle.
 * 
 * This file is part of TrackedBean.
 * 
 * TrackedBean is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * TrackedBean is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with TrackedBean. If not, see <http://www.gnu.org/licenses/>.
 */
package ch.trackedbean.data;

import java.util.*;
import ch.trackedbean.business.*;
import ch.trackedbean.copier.annotations.*;
import ch.trackedbean.data.evaluator.*;
import ch.trackedbean.data.validator.*;
import ch.trackedbean.validator.annotations.*;

/**
 * TO for {@link DomB} and {@link DomC}.
 * 
 * @author M. Hautle
 */
@SourceClass(DomC.class)
@ValidateBusinessContent(value = DomCValidator.class, resolver = MappingResolver.class)
public class TOBC extends TOA {
    public static final String ATTR_IGNORE = "ignore";

    public static final String ATTR_EXTERNAL_B = "externalB";

    public static final String ATTR_EXT_LIST = "extList";

    public static final String ATTR_SIMPLE_C = "simpleC";

    public static final String ATTR_SIMPLE_B = "simpleB";

    public static final String ATTR_LIST = "list";

    /** Property with the same name but mapped to {@link DomB} and not on the source bean ({@link DomB#ATTR_EXTERNAL_B}). */
    @ExternalMapping(DomB.class)
    private int externalB;

    /** Property to exclude from implicit mapping (otherwise we would map {@link DomC#ATTR_IGNORE}). */
    @IgnoreMapping
    private String ignore;

    /** Property with different name ({@link DomC#ATTR_SIMPLE}). */
    @SimpleMapping(DomC.ATTR_SIMPLE)
    private String simpleC;

    /** Property with different name and located on {@link DomB} ({@link DomB#ATTR_SIMPLE}). */
    @SimpleMapping(value = DomB.ATTR_SIMPLE, srcClass = DomB.class)
    private String simpleB;

    /** List mapping of {@link DomC#ATTR_LIST}. A {@link DomEvaluator} will be used to figure out the destination bean types. */
    @DeepValidation
    @CollectionMapping(srcEvaluator = DomEvaluator.class)
    private List<TOA> list;

    /** List mapping of {@link DomB#ATTR_LIST_B}. All entries will be converted to {@link TOA} beans. */
    @DeepValidation
    @CollectionMapping(srcProperty = DomB.ATTR_LIST_B, dstType = TOA.class, srcClass = DomB.class)
    private Set<TOA> extList;

    /**
     * @return Returns the externalB.
     */
    public int getExternalB() {
        return externalB;
    }

    /**
     * @param externalB The externalB to set.
     */
    public void setExternalB(int externalB) {
        this.externalB = externalB;
    }

    /**
     * @return Returns the ignore.
     */
    public String getIgnore() {
        return ignore;
    }

    /**
     * @param ignore The ignore to set.
     */
    public void setIgnore(String ignore) {
        this.ignore = ignore;
    }

    /**
     * @return Returns the simpleC.
     */
    public String getSimpleC() {
        return simpleC;
    }

    /**
     * @param simpleC The simpleC to set.
     */
    public void setSimpleC(String simpleC) {
        this.simpleC = simpleC;
    }

    /**
     * @return Returns the simpleB.
     */
    public String getSimpleB() {
        return simpleB;
    }

    /**
     * @param simpleB The simpleB to set.
     */
    public void setSimpleB(String simpleB) {
        this.simpleB = simpleB;
    }

    /**
     * @return Returns the list.
     */
    public List<TOA> getList() {
        return list;
    }

    /**
     * @param list The list to set.
     */
    public void setList(List<TOA> list) {
        this.list = list;
    }

    /**
     * @return Returns the extList.
     */
    public Set<TOA> getExtList() {
        return extList;
    }

    /**
     * @param extList The extList to set.
     */
    public void setExtList(Set<TOA> extList) {
        this.extList = extList;
    }
}
